<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>父子组件</title>
    <script src="https://cdn.bootcss.com/vue/2.6.11/vue.js"></script>
    <script src="js/jquery.js"></script>
    <script>
        $(function () {
            var vm1 = new Vue({
                el: '#mydiv',
                data: {
                    comType: 'com1'
                },
                //1.组件嵌套定义
                components: {
                    'fathercom': {
                        template: '#mytemp1',
                        components: {
                            'soncom': {
                                template: '#mytemp2'
                            }
                        }
                    },
                }
            })
        })
    </script>
</head>

<body>
    <template id="mytemp1">
        <div>
            <h2>我是父组件A</h2>
            <p>下面出现的是我的子组件</p>
            <!-- 2.组件使用是需要嵌套 -->
            <soncom></soncom>
        </div>
    </template>
    <template id="mytemp2">
        <div>
            <h2>我是子组件B</h2>
        </div>
    </template>
    <div id="mydiv">
       <fathercom></fathercom>
    </div>
</body>

</html>